﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/design.Master" CodeBehind="list.aspx.vb" Inherits="CakeThatIBaked.list" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class = "theheader">The Cakes</div>
<p>
        <asp:GridView ID="GV_Cakes" runat="server" 
            AutoGenerateColumns="False" 
            DataSourceID="CakeDatabaseConnection" style="text-align: center" 
            AllowSorting="True"
            CssClass="gvcss"
            rowStyle-CssClass="gvr"
            alternatingrowstyle-CssClass="gvar"
            >
<AlternatingRowStyle CssClass="gvar"></AlternatingRowStyle>
            <Columns>
                <asp:ImageField DataImageUrlField="CakePictureMain" HeaderText="Thumbnail" 
                    SortExpression="CakeTitle">
                    <ControlStyle Height="100px" Width="100px" />
                </asp:ImageField>
                <asp:HyperLinkField DataNavigateUrlFields="ID" 
                    DataNavigateUrlFormatString="details.aspx?cakeNo={0}" DataTextField="CakeTitle" 
                    HeaderText="Cake Title" SortExpression="CakeTitle" >
                <ControlStyle Font-Bold="True" />
                </asp:HyperLinkField>
                <asp:BoundField DataField="UserName" HeaderText="Author" 
                    SortExpression="UserName" />
                <asp:BoundField DataField="CakeDescription" HeaderText="CakeDescription" 
                    SortExpression="CakeDescription" />
                <asp:TemplateField HeaderText="CakeRating" SortExpression="CakeRating">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CakeRating") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# cakeThatIBaked.Class1.showRating(Eval("CakeRating")) %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>

<RowStyle CssClass="gvr"></RowStyle>
        </asp:GridView>
        <asp:SqlDataSource ID="CakeDatabaseConnection" runat="server" 
            ConnectionString="<%$ ConnectionStrings:CakeConnection %>" 
            ProviderName="<%$ ConnectionStrings:CakeConnection.ProviderName %>" 
            
            
            SelectCommand="SELECT [CakeTitle], [Author], [CakeDescription], [CakeRating], [CakePictureMain], [UserName], [ID], [Score] FROM [CakeUserView]">
        </asp:SqlDataSource>
</p>
    <p>
        &nbsp;</p>
</asp:Content>
